#include<iostream>
#include<string>
#include<fstream>
#include<cctype>

using namespace std;

int main(int argc, char**argv){
	ifstream in(argv[argc-1]);
	if(!in.is_open())
		cout << "cann't open file " <<  argv[argc-1] << endl;

	long long ch = 0, wd = 0, ln = 0, sp = 0;
	string str;
	while(getline(in,str)){
		ln ++;
		int size = str.size();
		if(size == 0){
			ch ++;
			sp ++;
		}
		for(int i = 0; i < size; i ++){
			while(str[i] == ' '){
				sp ++;
				ch ++;
				i ++;
			}
			if(str[i] == '	')
				sp ++;
			if(!isalpha(str[i - 1])  && isalpha(str[i]) || isdigit(str[i-1]) && !isdigit(str[i]))
				wd ++; 
			ch ++;
		}
	}
	for(int i = 1; i < argc-1; i ++){
		string tmp = argv[i];
		if(tmp == "-c"){
			cout << "char count with space: " << ch << endl;
			cout << "char count without space: " << ch - sp << endl;
		}
		else if(tmp == "-w")
			cout << "word count: " << wd << endl;
		else
			cout << "line count: " << ln << endl;
	}

	return 0;
}
